package gr.handmademarket.ui.links;

import gr.handmademarket.po.interfaces.Category;
import gr.handmademarket.ui.pages.CategoryPage;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;

/**
 * ajax link leading to categories page.
 */
public class CategoryLink 
extends AjaxLink<String>{

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * the category.
	 */
	private Category category;
	
	/**
	 * Creates a new CategoryLink object. 
	 *
	 * @param id
	 */
	public CategoryLink(String id) {
		super(id);
	}

	
	@Override
	public void onClick(AjaxRequestTarget target) {
		setResponsePage(new CategoryPage(category));
	}

	/**
	 * @param category
	 */
	public void setCategory(Category category) {
		this.category = category;
	}

}
